package com.pdf.file;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;

/**
 * @User xiangyl
 * @Data 2020/10/1
 */
public class MyFile {

    public static void main(String[] args) {
        try {
            FileReader fileReader = new FileReader("D:\\test\\testFile03.txt");
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            FileWriter fileWriter = new FileWriter("D:\\test\\result.txt");
            int len=0;
            int count=0;
            while ((len=bufferedReader.read())!=-1){
                count++;
                fileWriter.write(bufferedReader.readLine()+"\n");

            }
            bufferedReader.close();
            fileWriter.flush();
            fileWriter.close();
            fileReader.close();
            System.out.println("finish!");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
